import javax.swing.*;
import java.util.Random;
import java.util.Scanner;

public class code {
    //汉诺塔问题
    public static void main(String[] args) {
     Scanner scan = new Scanner(System.in);
     int num = scan.nextInt();
     Hanoi(num,'A','B','C');
    }
    public static void Hanoi(int num , char A , char B,char C){
        if(num == 1){
            print(A,C);
        }else{
            Hanoi (num - 1,A,C,B);
            print(A,C);
            Hanoi(num - 1,B,A,C);
        }
    }
    public static void print(char A,char B){
        System.out.print(A+" -> "+B+ " ");
    }
    //青蛙跳台阶
    public static void main5(String[] args) {
        Scanner scan = new Scanner(System.in);
        int num = scan.nextInt();
        int count = QWT(num);
        System.out.println(count);
    }
    public static int QWT (int num){
        if(num == 1){
            return 1;
        }else if(num == 2){
            return 2;
        }else{
            return QWT(num - 1) + QWT(num - 2);
        }
    }
    public static void main4(String[] args) {
        Scanner scan = new Scanner(System.in);
        double Weight = 0;
        double hight = 0;

        System.out.println("这是一个高精度的BMI的计算器");
        do {
            System.out.println("请输入你的体重（KG）");
             Weight = scan.nextDouble();
            System.out.println("请输入你的身高（m）");
            hight = scan.nextDouble();
            double BMI = Weight / Math.pow(hight,2);
            System.out.println("BMI = "+BMI);
        }while(scan.hasNextDouble());
    }

    public static void main3(String[] args) {

        System.out.println("这是一个高精度计算BMI的计算器");
        Scanner scan = new Scanner(System.in);
        System.out.println("请输入体重 (kg)");
        while(scan.hasNextInt()) {

            double weight = scan.nextDouble();
            System.out.println("请输入身高 (m)");
            double high = scan.nextDouble();

            System.out.println("请输入体重(kg)");
            double  BMI = weight / Math.pow(high,2);
            System.out.println("BMI = "+ BMI);
            if(BMI > 25){
                System.out.println("超重，注意饮食");
            }else{
                System.out.println("营养不良，注意饮食");
            }
        }
    }
    public static void main2(String[] args) {
        Scanner scan = new Scanner(System.in);
        System.out.println("请输入你的年龄");
        int age = scan.nextInt();
        System.out.println(age);
        scan.nextLine();
        System.out.println("请输入你的名字");
        String name = scan.nextLine();
        System.out.println(name);
        System.out.println("请输入你的体重");
        double weight = scan.nextDouble();
        System.out.println(weight);

    }
    // 猜数字游戏
    public static void main1(String[] args) {
        Random random = new Random();
        int num = random.nextInt(100) + 1;
        System.out.println(num);
        Scanner scan = new Scanner(System.in);
        while(true){
            int i = scan.nextInt();
            if(i > num){
                System.out.println("输入太大了");
            }else if(i < num){
                System.out.println("输入太小了");
            }else{
                System.out.println("输入正确");
                break;
            }
        }

    }
}
